import Vue from 'vue'
import App from './App'
import router from './router'

import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';

Vue.config.productionTip = false

Vue.use(ElementUI);

// axios的默认前缀
import axios from "axios";
const host = "http://192.168.145.238:8080";
axios.defaults.baseURL = host;
Vue.prototype.$http = axios;

// 导航守卫
// 标签页标题自适应，页面跳转逻辑维护
router.beforeEach((to,from,next)=>{
  // if((to.path.indexOf("/write") >=0 || to.path.indexOf("/profile") >=0) && !window.sessionStorage.getItem("userId")){
  //   next({name:"login"})
  // }
  document.title = to.meta.title
  next()
})

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  render: h => h(App)
})
